package 设计模式.创建型模式.demo03生成器模式.director;

import 设计模式.创建型模式.demo03生成器模式.builders.AbstractCarBuilder;
import 设计模式.创建型模式.demo03生成器模式.cars.CarType;
import 设计模式.创建型模式.demo03生成器模式.components.Engine;
import 设计模式.创建型模式.demo03生成器模式.components.GPSNavigator;
import 设计模式.创建型模式.demo03生成器模式.components.TripComputer;

/**
 * @author: 王富贵
 * @description: 主管控制生成器
 * @createTime: 2022/11/07 14:35
 *
 * 主管直到客户大致需要什么汽车，先给他创建一些模板
 */
public class Director {
    public void constructSportsCar(AbstractCarBuilder builder) {
        builder.setCarType(CarType.SPORTS_CAR);
        builder.setSeats(2);
        builder.setEngine(new Engine(3.0, 0));
        builder.setTripComputer(new TripComputer());
        builder.setGPSNavigator(new GPSNavigator());
    }

    public void constructCityCar(AbstractCarBuilder builder) {
        builder.setCarType(CarType.CITY_CAR);
        builder.setSeats(2);
        builder.setEngine(new Engine(1.2, 0));
        builder.setTripComputer(new TripComputer());
        builder.setGPSNavigator(new GPSNavigator());
    }

    public void constructSUV(AbstractCarBuilder builder) {
        builder.setCarType(CarType.SUV);
        builder.setSeats(4);
        builder.setEngine(new Engine(2.5, 0));
        builder.setGPSNavigator(new GPSNavigator());
    }
}
